﻿using UnityEngine;
using UnityEngine.InputSystem;

namespace DoDove
{
    public class InputActionPlayerHandler : InputHandler
    {
        private DoDoveInputAction.PlayerActions _playerActions;
        #region 注册事件

        protected override void OnRegister()
        {
            _playerActions = inputManager.CurInputActions.Player; 
            _playerActions.PointPosition.performed += PointPositionCallBack;
            _playerActions.PointLeftButtonClick.performed += PointLeftBtnClick;
        }

        #endregion

        #region 事件行为处理

        private void PointLeftBtnClick(InputAction.CallbackContext context)
        {
            Debug.Log("-----PointLeftBtnClick");
            inputManager.SwitchOtherMap();
        }

        private void PointPositionCallBack(InputAction.CallbackContext context)
        {
            Vector2 pointerPos = context.ReadValue<Vector2>();
            Debug.Log("指针位置更新：" + pointerPos);
        }

        #endregion
    }
}